<%@ page import="java.sql.*" %>
<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<html>
  <head>
    
    <title>处理客户修改数据</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
<body>
    <% 
        String clientName=new String(request.getParameter("clientName")
            .getBytes("ISO-8859-1"),"UTF-8");
        String clientTelephone=new String(request.getParameter("clientTelephone")
            .getBytes("ISO-8859-1"),"UTF-8");
        String clientAddress=new String(request.getParameter("clientAddress")
            .getBytes("ISO-8859-1"),"UTF-8");
        String clientEmail=new String(request.getParameter("clientEmail")
            .getBytes("ISO-8859-1"),"UTF-8");
        Connection con=null;
        Statement stmt=null;
        if(clientName.equals("")){
            response.sendRedirect("../clientManage/updateClient.jsp");
        }
        else{
            try{
                Class.forName("com.mysql.jdbc.Driver");
                String url="jdbc:mysql://localhost:3306/eims?useUnicode=true&characterEncoding=gbk";
                con=DriverManager.getConnection(url,"root","123456");
                stmt=con.createStatement();
                String sql="update client set clientName='"
                    +clientName+"',clientTelephone='"+clientTelephone
                    +"',clientAddress='"+clientAddress+"',clientEmail='"+clientEmail+"' where clientName='"
                    +clientName+"'";
                stmt.executeUpdate(sql);
                response.sendRedirect("../clientManage/lookClient.jsp");
            }
            catch(Exception e){
                e.printStackTrace();
            }
            finally{
                stmt.close();
                con.close();
            }
        }
        
    %>
</body>
</html>